<template>
    <div class="home">
        <div>{{language['global-siteName']}} {{language['home-title']}}</div>
        <EchartsPie :data="echartPieOpt" class='chart'></EchartsPie>
    </div>
</template>
<script>
import EchartsPie from "@/components/echarts-pie";
export default {

    name: 'home',

    components: {
        EchartsPie
    },

    data() { 
        return {
            echartPieOpt: {}
        }
    },

    mounted() {
       this.drawChats();
       this.testMockAjax();
       this.testMockAjax();
       let tthis = this;
       setTimeout(function(){
           tthis.testMockAjax();
       },8000);
    },

    methods: {
        
        testMockAjax() {
            this.$store.dispatch('testMockAjax', this).then(function(response) {
                console.log(32,response);
            });
        },

        drawChats() {
            this.echartPieOpt = {
                ref:'home-echart-pie',
                legend: {
                    data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
                },
                series :  {
                    data:[
                        {value:335, name:'直接访问'},
                        {value:310, name:'邮件营销'},
                        {value:234, name:'联盟广告'},
                        {value:135, name:'视频广告'},
                        {value:1548, name:'搜索引擎'}
                    ]
                }
            }
        }
    }

};
</script>

<style scoped lang="less">
.home {
    font-size: 10px;
}

.chart {
    position: relative;
    left: 50%;
    margin-left: -400px;
    margin-bottom: 70px;
    width: 800px;
    height: 600px;
}
</style>